package atguigu.demo3

/**
  * Created by lzd on 2018/11/2.
  * tuple操作
  */
object demo3_6 {
  def main(args: Array[String]): Unit = {
    // 元组操作
    (1, 3.14, "Fred")

    val t = (1, 3.14, "Fred")

    val second = t._2

    val first = t _1

    //变量赋值
    val (first1, second1, third) = t

    val (first2, second2, _) = t


    // 拉链操作
    val symbols = Array("<", "-", ">")
    val counts = Array(2, 10, 2)
    val pairs = symbols.zip(counts)
    println("---" * 5)
    println(pairs.toBuffer)

    println("---" * 5)
    for ((s, n) <- pairs) print(s * n)


    println("\n"+symbols.zip(counts).toMap)
  }
}
